import 'package:wch/generated/json/base/json_convert_content.dart';
import 'package:wch/model/report_list_entity.dart';

import '../../model/acquisition_entity.dart';

ReportListEntity $ReportListEntityFromJson(Map<String, dynamic> json) {
  final ReportListEntity reportListEntity = ReportListEntity();
  final String? code = jsonConvert.convert<String>(json['code']);
  if (code != null) {
    reportListEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    reportListEntity.msg = msg;
  }
  final ReportListData? data = jsonConvert.convert<ReportListData>(
      json['data']);
  if (data != null) {
    reportListEntity.data = data;
  }
  return reportListEntity;
}

Map<String, dynamic> $ReportListEntityToJson(ReportListEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data?.toJson();
  return data;
}

extension ReportListEntityExtension on ReportListEntity {
  ReportListEntity copyWith({
    String? code,
    String? msg,
    ReportListData? data,
  }) {
    return ReportListEntity()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

ReportListData $ReportListDataFromJson(Map<String, dynamic> json) {
  final ReportListData reportListData = ReportListData();
  final int? pageIndex = jsonConvert.convert<int>(json['pageIndex']);
  if (pageIndex != null) {
    reportListData.pageIndex = pageIndex;
  }
  final int? pageSize = jsonConvert.convert<int>(json['pageSize']);
  if (pageSize != null) {
    reportListData.pageSize = pageSize;
  }
  final int? totalPage = jsonConvert.convert<int>(json['totalPage']);
  if (totalPage != null) {
    reportListData.totalPage = totalPage;
  }
  final int? totalCount = jsonConvert.convert<int>(json['totalCount']);
  if (totalCount != null) {
    reportListData.totalCount = totalCount;
  }
  final List<ReportListDataData>? data = (json['data'] as List<dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<ReportListDataData>(e) as ReportListDataData)
      .toList();
  if (data != null) {
    reportListData.data = data;
  }
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    reportListData.total = total;
  }
  final int? current = jsonConvert.convert<int>(json['current']);
  if (current != null) {
    reportListData.current = current;
  }
  final dynamic records = json['records'];
  if (records != null) {
    reportListData.records = records;
  }
  final int? size = jsonConvert.convert<int>(json['size']);
  if (size != null) {
    reportListData.size = size;
  }
  final int? pages = jsonConvert.convert<int>(json['pages']);
  if (pages != null) {
    reportListData.pages = pages;
  }
  return reportListData;
}

Map<String, dynamic> $ReportListDataToJson(ReportListData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['pageIndex'] = entity.pageIndex;
  data['pageSize'] = entity.pageSize;
  data['totalPage'] = entity.totalPage;
  data['totalCount'] = entity.totalCount;
  data['data'] = entity.data?.map((v) => v.toJson()).toList();
  data['total'] = entity.total;
  data['current'] = entity.current;
  data['records'] = entity.records;
  data['size'] = entity.size;
  data['pages'] = entity.pages;
  return data;
}

extension ReportListDataExtension on ReportListData {
  ReportListData copyWith({
    int? pageIndex,
    int? pageSize,
    int? totalPage,
    int? totalCount,
    List<ReportListDataData>? data,
    int? total,
    int? current,
    dynamic records,
    int? size,
    int? pages,
  }) {
    return ReportListData()
      ..pageIndex = pageIndex ?? this.pageIndex
      ..pageSize = pageSize ?? this.pageSize
      ..totalPage = totalPage ?? this.totalPage
      ..totalCount = totalCount ?? this.totalCount
      ..data = data ?? this.data
      ..total = total ?? this.total
      ..current = current ?? this.current
      ..records = records ?? this.records
      ..size = size ?? this.size
      ..pages = pages ?? this.pages;
  }
}

ReportListDataData $ReportListDataDataFromJson(Map<String, dynamic> json) {
  final ReportListDataData reportListDataData = ReportListDataData();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    reportListDataData.id = id;
  }
  final String? hospitalId = jsonConvert.convert<String>(json['hospitalId']);
  if (hospitalId != null) {
    reportListDataData.hospitalId = hospitalId;
  }
  final String? doctorId = jsonConvert.convert<String>(json['doctorId']);
  if (doctorId != null) {
    reportListDataData.doctorId = doctorId;
  }
  final String? sickPersonId = jsonConvert.convert<String>(
      json['sickPersonId']);
  if (sickPersonId != null) {
    reportListDataData.sickPersonId = sickPersonId;
  }
  final String? userName = jsonConvert.convert<String>(json['userName']);
  if (userName != null) {
    reportListDataData.userName = userName;
  }
  final String? mobile = jsonConvert.convert<String>(json['mobile']);
  if (mobile != null) {
    reportListDataData.mobile = mobile;
  }
  final String? sex = jsonConvert.convert<String>(json['sex']);
  if (sex != null) {
    reportListDataData.sex = sex;
  }
  final int? age = jsonConvert.convert<int>(json['age']);
  if (age != null) {
    reportListDataData.age = age;
  }
  final String? hospital = jsonConvert.convert<String>(json['hospital']);
  if (hospital != null) {
    reportListDataData.hospital = hospital;
  }
  final String? department = jsonConvert.convert<String>(json['department']);
  if (department != null) {
    reportListDataData.department = department;
  }
  final String? deviceName = jsonConvert.convert<String>(json['deviceName']);
  if (deviceName != null) {
    reportListDataData.deviceName = deviceName;
  }
  final String? deviceId = jsonConvert.convert<String>(json['deviceId']);
  if (deviceId != null) {
    reportListDataData.deviceId = deviceId;
  }
  final String? acquisitionNumber = jsonConvert.convert<String>(
      json['acquisitionNumber']);
  if (acquisitionNumber != null) {
    reportListDataData.acquisitionNumber = acquisitionNumber;
  }
  final int? duration = jsonConvert.convert<int>(json['duration']);
  if (duration != null) {
    reportListDataData.duration = duration;
  }
  final String? stageStatus = jsonConvert.convert<String>(json['stageStatus']);
  if (stageStatus != null) {
    reportListDataData.stageStatus = stageStatus;
  }
  final String? stageDataStatus = jsonConvert.convert<String>(
      json['stageDataStatus']);
  if (stageDataStatus != null) {
    reportListDataData.stageDataStatus = stageDataStatus;
  }
  final String? fileUrl = jsonConvert.convert<String>(json['fileUrl']);
  if (fileUrl != null) {
    reportListDataData.fileUrl = fileUrl;
  }
  final String? status = jsonConvert.convert<String>(json['status']);
  if (status != null) {
    reportListDataData.status = status;
  }
  final String? startTime = jsonConvert.convert<String>(json['startTime']);
  if (startTime != null) {
    reportListDataData.startTime = startTime;
  }
  final String? finishTime = jsonConvert.convert<String>(json['finishTime']);
  if (finishTime != null) {
    reportListDataData.finishTime = finishTime;
  }
  final int? finishType = jsonConvert.convert<int>(json['finishType']);
  if (finishType != null) {
    reportListDataData.finishType = finishType;
  }
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    reportListDataData.createTime = createTime;
  }
  final String? updateTime = jsonConvert.convert<String>(json['updateTime']);
  if (updateTime != null) {
    reportListDataData.updateTime = updateTime;
  }
  final List<AcquisitionAcquisitionLabelList>? labelList = (json['labelList'] as List<dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<AcquisitionAcquisitionLabelList>(e) as AcquisitionAcquisitionLabelList)
      .toList();
  if (labelList != null) {
    reportListDataData.labelList = labelList;
  }
  final int? btnCount = jsonConvert.convert<int>(json['btnCount']);
  if (btnCount != null) {
    reportListDataData.btnCount = btnCount;
  }
  return reportListDataData;
}

Map<String, dynamic> $ReportListDataDataToJson(ReportListDataData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['hospitalId'] = entity.hospitalId;
  data['doctorId'] = entity.doctorId;
  data['sickPersonId'] = entity.sickPersonId;
  data['userName'] = entity.userName;
  data['mobile'] = entity.mobile;
  data['sex'] = entity.sex;
  data['age'] = entity.age;
  data['hospital'] = entity.hospital;
  data['department'] = entity.department;
  data['deviceName'] = entity.deviceName;
  data['deviceId'] = entity.deviceId;
  data['acquisitionNumber'] = entity.acquisitionNumber;
  data['duration'] = entity.duration;
  data['stageStatus'] = entity.stageStatus;
  data['stageDataStatus'] = entity.stageDataStatus;
  data['fileUrl'] = entity.fileUrl;
  data['status'] = entity.status;
  data['startTime'] = entity.startTime;
  data['finishTime'] = entity.finishTime;
  data['finishType'] = entity.finishType;
  data['createTime'] = entity.createTime;
  data['updateTime'] = entity.updateTime;
  data['labelList'] = entity.labelList;
  data['btnCount'] = entity.btnCount;
  return data;
}

extension ReportListDataDataExtension on ReportListDataData {
  ReportListDataData copyWith({
    String? id,
    String? hospitalId,
    String? doctorId,
    String? sickPersonId,
    String? userName,
    String? mobile,
    String? sex,
    int? age,
    String? hospital,
    String? department,
    String? deviceName,
    String? deviceId,
    String? acquisitionNumber,
    int? duration,
    String? stageStatus,
    String? stageDataStatus,
    String? fileUrl,
    String? status,
    String? startTime,
    String? finishTime,
    int? finishType,
    String? createTime,
    String? updateTime,
    List<AcquisitionAcquisitionLabelList>? labelList,
    int? btnCount,
  }) {
    return ReportListDataData()
      ..id = id ?? this.id
      ..hospitalId = hospitalId ?? this.hospitalId
      ..doctorId = doctorId ?? this.doctorId
      ..sickPersonId = sickPersonId ?? this.sickPersonId
      ..userName = userName ?? this.userName
      ..mobile = mobile ?? this.mobile
      ..sex = sex ?? this.sex
      ..age = age ?? this.age
      ..hospital = hospital ?? this.hospital
      ..department = department ?? this.department
      ..deviceName = deviceName ?? this.deviceName
      ..deviceId = deviceId ?? this.deviceId
      ..acquisitionNumber = acquisitionNumber ?? this.acquisitionNumber
      ..duration = duration ?? this.duration
      ..stageStatus = stageStatus ?? this.stageStatus
      ..stageDataStatus = stageDataStatus ?? this.stageDataStatus
      ..fileUrl = fileUrl ?? this.fileUrl
      ..status = status ?? this.status
      ..startTime = startTime ?? this.startTime
      ..finishTime = finishTime ?? this.finishTime
      ..finishType = finishType ?? this.finishType
      ..createTime = createTime ?? this.createTime
      ..updateTime = updateTime ?? this.updateTime
      ..labelList = labelList ?? this.labelList
      ..btnCount = btnCount ?? this.btnCount;
  }
}